package com.cskaoyan.interceptor;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.springframework.stereotype.Component;

/**
 * @author stone
 * @date 2022/03/22 10:53
 */
@Component
public class HelloWorldInterceptor implements MethodInterceptor {
    @Override
    public Object invoke(MethodInvocation methodInvocation) throws Throwable {
        System.out.println("hello");
        //执行委托类代码
        Object proceed = methodInvocation.proceed();//类似于method.invoke
        System.out.println("world");

        return proceed;
    }
}
